package com.eng.carro.services;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.TypedQuery;

import com.eng.carro.entities.Order;
import com.eng.carro.entities.User;

@Stateless
public class OrderService extends BaseServiceProvider<Order, Integer>{
  
  public List<Order> ordersByPriority() {
	TypedQuery<Order> query = em.createQuery("select v from " + getPersistentClass().getSimpleName() + " v where v.status = 0 order by v.priority", Order.class);
	return query.getResultList();
  }
  
  public List<Order> ordersByPriorityByUser() {
	TypedQuery<Order> query = em.createQuery("select v from " + getPersistentClass().getSimpleName() + " v where v.status = 3 order by v.priority", Order.class);
	return query.getResultList();
  }
}
